<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Auto Jump to XyLink </title>
</head>


<body>
WebSocket 测试页面
<input id="text" type="text"/>
<input type="submit" onclick="send()" >
<button onclick="closeWebSocket()">关闭</button>
<div id="message"></div>
</body>
<!--<a href="dingtalk://dingtalkclient/action/openapp?corpid=$CORPID$&container_type=work_platform&app_id=0_1234&redirect_type=jump&redirect_url=xylink://joinMeeting?number=9083424242&topic=&pwd=ODg3Nzg4&displayName=5bel5Y+377yabnVsbC3lp5PlkI3vvJpudWxsLeaJgOWxnumDqOmXqO+8mm51bGw=&autoAudioMute=true&autoVideoMute=true&contentOnlyMode=true&quitWhenCallFinish=true">-->
<!-- 点击此处快速入会-->
<!--</a>-->


<!--<a href="xylink://joinMeeting?number=9083424242&topic=&pwd=887788&displayName=信息中心-胡震-工号(532456)&autoAudioMute=true&autoVideoMute=true&contentOnlyMode=true&quitWhenCallFinish=true" target="_blank">免登录进入小鱼会议</a>-->
<!--</body>-->

<!-- 引入jweixin JS文件 -->
<script src="//res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script src="${path }/static/js/jquery-3.1.1.js"></script>
<script type="text/javascript">

    document.addEventListener('DOMContentLoaded', function() {
         params = new URLSearchParams(window.location.search);
         number =params.get('number');
         pwd = params.get('pwd')
        displayName=params.get("displayName")
       didMount(number,pwd,displayName);
    });

     function  didMount(number,pwd,displayName) {
        console.log("")
//document.title =window.loginUser.userName +'宜搭';
         number ="9083424242";
         pwd = "ODg3Nzg4";
        onClick(number, pwd,displayName);
    }


          function onClick(number,pwd,displayName){
            console.log('onClick');
            var url="xylink://joinMeeting?number="+number+"&topic=&pwd="+pwd+"&autoAudioMute=true&autoVideoMute=true&contentOnlyMode=true&quitWhencallFinish=true";
            // var url="xylink://joinMeeting?number="+number+"&topic=&pwd="+pwd+"&displayName="+displayName+"&autoAudioMute=true&autoVideoMute=true&contentOnlyMode=true&quitWhencallFinish=true";

              console.log(url);
            window.location.href =url;
        }



            wx.invoke('openDefaultBrowser', {
        'url': "https://open.weixin.gg.com/connect/oauth2/authorize?appid=wx588536578c0d3b2e&redirect uri=http\n" +
            "s%3A%2F%2Fjingpai.yunxuetang.cn%2Fauth%2Feco%2Fbind%2Fweixin%3Ft%3D1&response type=cod\n" +
            "e&scope=snsapi base&state=4f5a9bc5f4f54943b54aae18138e66c0%7c1000207#wechat redirect", // 在默认浏览器打开redirect_uri，并附加code参数；也可以直接指定要打开的url，此时不会附带上code参数。
    }, function(res){
        if(res.err_msg != "openDefaultBrowser:ok"){
            //错误处理
        }
    });





    var websocket=null;

    //判断浏览器是否支持WebSocket
    if('WebSocket' in window){
        //连接WebSocket节点,接口的名称要和@ServerEndpoint注解的名称保持一致
        websocket=new WebSocket("ws://localhost:8066/websocketApi/879");

    }else {

        alert("No Support WebSocket!!!!!!")
    }


    //连接发生错误时，做出的提示信息
    websocket.onerror=function () {
        setMessageInnerHTML("Error")

    }

    //连接成功时，做出的提示信息
    websocket.onopen=function (event) {
        setMessageInnerHTML("连接成功.......")

    }


    //收到的消息的，回调方法
    websocket.onmessage=function (event) {
        setMessageInnerHTML(event.data)

    }

    //断开连接触发的方法
    window.onbeforeunload=function () {
        websocket.close();
    }

    //将消息显示的网页上
    function setMessageInnerHTML(innerHTML) {
        document.getElementById("message").innerHTML+=innerHTML+'<br/>'
    }

    //关闭连接
    function closeWebSocket() {
        websocket.close();
    }

    //发送消息
    function send() {
        console.log("8886888")
        var message = document.getElementById("text").value;
        console.log(message)
        websocket.send(message);
    }

</script>

</html>